package com.guochenglang.www.dao;

import com.guochenglang.www.pojo.Base;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface BaseDao {
    /**
     * 知识库搜索
     *
     * @param base 搜索条件
     * @return 知识库列表
     * @throws SQLException           sql异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     * @throws InterruptedException   断点异常
     */
    ArrayList<Base> baseSelect(Base base) throws SQLException, IllegalAccessException, InstantiationException, InterruptedException;

    /**
     * 分页查询知识库
     *
     * @param page  页面
     * @param num   一页显示个数
     * @param base  搜索条件
     * @param order 排序的根据
     * @param mode  升序还是降序
     * @return 知识库表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Base> baseSelectByLimit(int page, int num, Base base, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 添加知识库
     *
     * @param base 知识库信息
     * @return 知识库的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int insertBase(Base base) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 更新知识库
     *
     * @param set        更新知识库信息
     * @param conditions 更新条件
     * @return 更新行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int updateBase(Base set, Base conditions) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 删除知识库
     *
     * @param conditions 删除条件
     * @return 删除行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int deleteBase(Base conditions) throws SQLException, InterruptedException, IllegalAccessException;
}
